{include file="header"}
<div style="padding: 20px;" class="layui-form adminmyucms">
<div class="layui-tab layui-tab-brief adminmyucms" lay-filter="docDemoTabBrief">
  <ul class="layui-tab-title">
  	{volist name=":fun_s('model',array(),'px desc',100,1)" id="vo"}
    <a href="{:url('html/index',array('id'=>$vo['id']))}"><li {if condition="$vo['id'] eq $id"}class="layui-this"{/if}>{$vo.title}</li></a>
     {/volist}
  </ul>
</div> 
	
<div class="layui-form-item">
<form class="ayui-form-pane ">
	<div class="layui-form">
	 <table class="layui-table">
  <colgroup>
    <col width="50">
    <col width="50">
        <col width="50">
    <col>
  </colgroup>
  <tbody>
    <tr>
    <td id="admin_set"><button  data-method="admin_set" type="button" url="{:url('html/add',array('id'=>$id))}" class="layui-btn layui-btn-normal"> <i class="layui-icon">&#xe654;</i>增加内容</button></td>
      <td><button class="layui-btn layui-btn-danger" data-url="{:url('html/delss')}" lay-submit lay-filter="alldelete">删除选中</button></td>
      <td><input type="number" name="yidong" value=""  placeholder="栏目id" autocomplete="off" class="layui-input" style="width:100px"></td>
      <td><button class="layui-btn layui-btn-normal" data-url="{:url('html/yidong')}" lay-submit lay-filter="yidong">移动选中</button></td>
    </tr>
  </tbody>
</table>
 </div>
</form>

<form class="ayui-form-pane " action="/admin.php/html/index/id/{$id}.html" method="get" style="float: right;">
	<div class="layui-form">
	 <table class="layui-table">
  <tbody>
    <tr>
 
 
      <td>
      	<select name="tid" lay-filter="selecttid">
      	     <option value="0">全部</option>
			 {foreach name=":fun_S('cate',array('open'=>1,'tid'=>0),'px desc','1000',1)" item="v" key="k"}
			 <option value="{$v.id}"  {if condition="$v['model'] neq fun_sc_p('model', array('name'=>$model), 'id')"}disabled=""{/if} {if condition="$tid eq $v['id']"}selected="selected"{/if}>{$v.name}</option>
			 {volist name=":fun_s('cate',array('open'=>1,'tid'=>$v['id']),'px desc',100,1)" id="vo"}
			  <option value="{$vo.id}" {if condition="$vo['model'] neq fun_sc_p('model', array('name'=>$model), 'id')"}disabled=""{/if} {if condition="$tid eq $vo['id']"}selected="selected"{/if}>——{$vo.name}</option>
			 {/volist} 
			 {/foreach} 
		</select>
	  </td>
      <td>
       <select name="open" lay-filter="selectopen">
		   <option  value="">状态</option>
		   <option {if condition="$open eq '0'"}selected="selected"{/if} value="0">待审</option>
		   <option {if condition="$open eq 1"}selected="selected"{/if} value="1">正常</option>
		   <option {if condition="$open eq 2"}selected="selected"{/if} value="2">不通过</option>
		   <option {if condition="$open eq -1"}selected="selected"{/if} value="-1">关闭</option>
		</select>
	  </td>
      <td><input type="text" placeholder="开始日期" value="{$startdate}" name="startdate" class="layui-input" id="startdate"></td>
      <td><input type="text" placeholder="结束日期" value="{$enddate}" name="enddate" class="layui-input" id="enddate"></td>
      <td>
        <select name="settop" lay-filter="selectopen">
            <option  value="">是否置顶</option>
            <option {if condition="$settop eq 1"}selected="selected"{/if} value="1">置顶</option>
            <option {if condition="$settop eq '0'"}selected="selected"{/if} value="0">普通</option>
        </select>
      </td>
      <td>
      	<select name="slide" lay-filter="selectopen">
            <option  value="">幻灯片</option>
            <option {if condition="$slide eq 1"}selected="selected"{/if} value="1">开启</option>
            <option {if condition="$slide eq '0'"}selected="selected"{/if} value="0">关闭</option>
        </select>
      </td>
      <td><input type="text" name="keyword" value="{$keyword}" placeholder="关键词" class="layui-input"></td>
      <td><div class="layui-inline" style="width:50px"><input type="number" name="perpage" value="{$perpage}" title placeholder="每页条数" class="layui-input"></td>
      <td><button class="layui-btn layui-btn-normal">搜索</button></td>
 
    </tr>
  </tbody>
</table>
 </div>
</form>




<table class="layui-table">
  <colgroup>
     <col width="50">
    <col width="50">
    <col width="100">
    <col width="200">
    <col width="100">
    <col width="100">
    <col width="100">
    <col width="50">
    <col width="100">
    <col width="100">
    <col width="100">
    <col width="100">
    
    <col>
  </colgroup>
  <thead>
    <tr>
      <th width="40px" align="center"><input type="checkbox" name="checkAll" lay-filter="checkAll" title="全选"></th>
      <th>ID</th>
      <th>所属栏目</th>
      <th>标题</th>
      <th>状态</th>
      <th>置顶</th>
      <th>幻灯片</th>
      <th>点击量</th>
      <th>作者</th>
      <th>添加时间</th>
      <th>更新时间</th>
      <th>管理操作</th>
    </tr> 
  </thead>
  <tbody >
 
	{volist name="html" id="vo"}
    <tr>
      <td align="center" ><input type="checkbox" name="ids[{$vo.id}]" lay-filter="checkOne" value="{$vo.id}" title="选择"><input type="hidden" name="id" value="{$id}"></td>
      <th>{$vo.id}</th>
      <th><a target="_blank" href="*URL*/m_{:fun_sc_p('cate', array('id'=>$vo['tid']), 'alias')}.html">{:fun_sc_p('cate', array('id'=>$vo['tid']), 'name')}[{:fun_sc_p('cate', array('id'=>$vo['tid']), 'id')}]</a></th>
      <!--<th><a target="_blank" href="{:url('html/article',array('id'=>$vo['id']))}">{$vo.title}</a></th>-->
      <th><a target="_blank" href="*URL*/s_{:m($vo['model'])}_{$vo.id}.html">{$vo.title}</a></th>
      <th><input type="checkbox" lay-skin="switch" url="{:url("set/updateindex")}?id={$vo.id}&m={$model}&or=open"  lay-submit lay-filter="index" value="{$vo.id}" lay-text="正常|待审"  {if condition="$vo['open'] eq 1"}checked{/if}></th>
      <th><input type="checkbox" lay-skin="switch" url="{:url("set/updateindex")}?id={$vo.id}&m={$model}&or=settop"  lay-submit lay-filter="index" value="{$vo.id}" lay-text="开启|关闭"  {if condition="$vo['settop'] eq 1"}checked{/if}></th>
      <th><input type="checkbox" lay-skin="switch" url="{:url("set/updateindex")}?id={$vo.id}&m={$model}&or=slide"  lay-submit lay-filter="index" value="{$vo.id}" lay-text="开启|关闭"  {if condition="$vo['slide'] eq 1"}checked{/if}></th>
      <th>{$vo.view} 次</th>
      <th>{:fun_sc_p('member', array('userid'=>$vo['uid']), 'username')}</th>
      <th>{$vo.time|timeinfo}</th>
      <th>{$vo.times|timeinfo}</th>
      <th>
      	<div class="layui-btn-group" id="admin_set">
      		 <button  data-method="admin_set" member-id="{$vo.id}" url="/admin.php/html/edit/id/{$vo.id}?model={$model}" type="button" class="layui-btn layui-btn-lg layui-btn-normal layui-btn-sm"> <i class="layui-icon">&#xe642;</i>修改</button>
      		 <!--
      		 <button  member-name="确定要删除 {$vo.title} 吗? " url="{:url("set/delete")}?id={$vo.id}&m={$model}" lay-submit lay-filter="delete"  class="layui-btn layui-btn-danger layui-btn-sm"> <i class="layui-icon">&#xe640;</i>删除</button>
      		 -->
        </div>
      </th>
    </tr>
{/volist}  

  </tbody>
</table>

<div class="pages">
{$html->render()}
<div>
<div>
<script>
    layui.use(['layer','jquery','form', 'laydate'], function() {
        var form = layui.form,
            laydate = layui.laydate,
            $form = $('form'),
            jq = layui.jquery;
        form.on('select()', function(data) {
            $form.submit();
        });

        laydate.render({
            elem: '#startdate' //指定元素
                ,
            done: function(value, date) {
                $form.submit();
            }
        });
        laydate.render({
            elem: '#enddate' //指定元素
                ,
            done: function(value, date) {
                $form.submit();
            }
        });
 
  
  form.on('checkbox(checkAll)', function(data){
    if(data.elem.checked){
      jq("input[lay-filter='checkOne']").prop('checked',true);
    }else{
      jq("input[lay-filter='checkOne']").prop('checked',false);
    }
    form.render('checkbox');
  });  

  form.on('checkbox(checkOne)', function(data){
    var is_check = true;
    if(data.elem.checked){
      jq("input[lay-filter='checkOne']").each(function(){
        if(!jq(this).prop('checked')){ is_check = false; }
      });
      if(is_check){
        jq("input[lay-filter='checkAll']").prop('checked',true);
      }
    }else{
      jq("input[lay-filter='checkAll']").prop('checked',false);
    } 
    form.render('checkbox');
  });

  form.on('submit(alldelete)', function(data){
    var is_check = false;
    jq("input[lay-filter='checkOne']").each(function(){
      if(jq(this).prop('checked')){ is_check = true; }
    });
    if(!is_check){
      layer.msg('请选择数据', {icon: 2,anim: 6,time: 1000});
      return false;
    }
    var url= jq(this).data('url');
   
    layer.confirm('确定批量删除数据吗?', function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      var param = data.field;
    
      jq.post(url,param,function(data){
        if(data.code == 200){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2,anim: 6, time: 1000});
        }
      });
    });
    return false;
  });
  form.on('submit(yidong)', function(data){
    var is_check = false;
    jq("input[lay-filter='checkOne']").each(function(){
      if(jq(this).prop('checked')){ is_check = true; }
    });
    if(!is_check){
      layer.msg('请选择数据', {icon: 2,anim: 6,time: 1000});
      return false;
    }
    var url= jq(this).data('url');
   
    layer.confirm('确定批量移动数据吗?', function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      var param = data.field;
    
      jq.post(url,param,function(data){
        if(data.code == 200){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2,anim: 6, time: 1000});
        }
      });
    });
    return false;
  });
  }); 
</script>
{include file="footer"}